// @ts-ignore
/* eslint-disable */
import request from "@/utils/http";

/** 创建角色 POST /api/role */
export async function createRole(
  body: Api.CreateRoleCommand,
  options?: { [key: string]: any }
) {
  return request<Api.Result1Guid>("/api/role", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
    },
    data: body,
    ...(options || {}),
  });
}

/** 批量删除角色 DELETE /api/role */
export async function batchDeleteRole(
  body: Api.BatchDeleteRoleCommand,
  options?: { [key: string]: any }
) {
  return request<Api.Result1Boolean>("/api/role", {
    method: "DELETE",
    headers: {
      "Content-Type": "application/json",
    },
    data: body,
    ...(options || {}),
  });
}

/** 修改角色 PUT /api/role/${param0} */
export async function updateRole(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: Api.updateRoleParams,
  body: Api.UpdateRoleCommand,
  options?: { [key: string]: any }
) {
  const { id: param0, ...queryParams } = params;
  return request<Api.Result1Boolean>(`/api/role/${param0}`, {
    method: "PUT",
    headers: {
      "Content-Type": "application/json",
    },
    params: { ...queryParams },
    data: body,
    ...(options || {}),
  });
}

/** 分配菜单 POST /api/role/${param0}/assign */
export async function assignMenusToRole(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: Api.assignMenusToRoleParams,
  body: Api.AssignMenusToRoleCommand,
  options?: { [key: string]: any }
) {
  const { id: param0, ...queryParams } = params;
  return request<Api.Result1Boolean>(`/api/role/${param0}/assign`, {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
    },
    params: { ...queryParams },
    data: body,
    ...(options || {}),
  });
}

/** 查询指定角色的菜单权限 POST /api/role/${param0}/menus */
export async function getRoleMenusById(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: Api.getRoleMenusByIdParams,
  body: Api.GetRoleMenusByIdQuery,
  options?: { [key: string]: any }
) {
  const { id: param0, ...queryParams } = params;
  return request<Api.Result1IEnumerable1RoleMenuDto>(
    `/api/role/${param0}/menus`,
    {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
      },
      params: { ...queryParams },
      data: body,
      ...(options || {}),
    }
  );
}

/** 启用/禁用角色 POST /api/role/${param0}/status */
export async function setRoleEnabledStatus(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: Api.setRoleEnabledStatusParams,
  body: Api.SetRoleEnabledStatusCommand,
  options?: { [key: string]: any }
) {
  const { id: param0, ...queryParams } = params;
  return request<Api.Result1Boolean>(`/api/role/${param0}/status`, {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
    },
    params: { ...queryParams },
    data: body,
    ...(options || {}),
  });
}

/** 查询全部角色 GET /api/role/all */
export async function getAllRoles(options?: { [key: string]: any }) {
  return request<Api.Result1IEnumerable1RoleDto>("/api/role/all", {
    method: "GET",
    ...(options || {}),
  });
}

/** 查询角色菜单 GET /api/role/menus */
export async function getRoleMenus(options?: { [key: string]: any }) {
  return request<Api.Result1IEnumerable1RoleMenuDto>("/api/role/menus", {
    method: "GET",
    ...(options || {}),
  });
}

/** 分页查询角色 GET /api/role/page */
export async function queryRoles(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: Api.queryRolesParams,
  options?: { [key: string]: any }
) {
  return request<Api.Result1PaginatedData1RoleDto>("/api/role/page", {
    method: "GET",
    params: {
      ...params,
    },
    ...(options || {}),
  });
}
